<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:conv="clr-namespace:QuickZip.Converters"            
    xmlns:local="clr-namespace:QuickZip.UserControls"            
    xmlns:sys="clr-namespace:System;assembly=mscorlib" 
    xmlns:lc="clr-namespace:LoadingControl.Control"
    xmlns:ce="clr-namespace:CircularAnimations.Examples"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Brushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Geometry.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Converters.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Templates.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Styles.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Templates/TitlebarTemplates.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="{x:Type local:DialogControl}"                       
           TargetType="{x:Type local:DialogControl}" >

        <!--<Setter Property="Height" Value="20"  />-->
        <Setter Property="HorizontalAlignment" Value="Stretch"  />
        <Setter Property="VerticalAlignment" Value="Stretch"  />
        <Setter Property="FocusVisualStyle" Value="{StaticResource focusVisualStyle}" />

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:DialogControl}">
                    <Grid>
                        <ContentControl Content="{TemplateBinding Content}"  />
                        <Grid HorizontalAlignment="Center" VerticalAlignment="Center"
                            Visibility="{Binding IsDialogVisible, 
                                        RelativeSource={RelativeSource TemplatedParent}, 
                                        Converter={StaticResource btvc}}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="10" />
                                <RowDefinition Height="Auto" MinHeight="20" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <!--<Border Opacity="0.5" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="3" 
                                    BorderBrush="{StaticResource SolidBorderBrush}" BorderThickness="1"
                                    Background="Silver">                                
                            </Border>-->

                            <Border  Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Grid.RowSpan="2"  CornerRadius="3" 
                                 BorderBrush="{StaticResource SolidBorderBrush}"  
                                     Background="{StaticResource WindowBackgroundBrush}"
                                     BorderThickness="1"  Padding="3"
                                >
                                <Border  BorderBrush="{StaticResource SolidBorderBrush}" 
                                         BorderThickness="1"
                                         Background="{StaticResource WindowBackgroundBrush}">
                                    <DockPanel>
                                        <Border DockPanel.Dock="Top" Padding="3"
                                            BorderBrush="{StaticResource SolidBorderBrush}" BorderThickness="0,0,0,2">

                                            <DockPanel>
                                                <Path DockPanel.Dock="Left" Width="32" Height="32" 
                                                      Data="{StaticResource Folder}" Stretch="Uniform"  
                                                      Stroke="{StaticResource SolidBorderBrush}" StrokeThickness="1"
                                                      />
                                                <ContentControl 
                                                    Margin="10,0,0,0" VerticalAlignment="Center"
                                                    Content="{Binding DialogContent.Title,                                                     
                                                    RelativeSource={RelativeSource TemplatedParent}}" />
                                            </DockPanel>
                                        </Border>
                                        
                                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Bottom">
                                            <Button x:Name="bYes" Content="Yes" Visibility="Collapsed" />
                                            <Button x:Name="bNo" Content="No" Visibility="Collapsed" />                                            
                                            <Button x:Name="bCancel" Content="Cancel" Visibility="Collapsed" />
                                            <Button x:Name="bOK" Content="OK" Visibility="Collapsed" />
                                        </StackPanel>

                                        <ContentControl                                         
                                        Content="{TemplateBinding DialogContent}" MinHeight="100" MinWidth="200" />
                                    </DockPanel>
                                </Border>
                            </Border>

                            <!--<ContentControl Grid.Row="1" Grid.Column="0" MinWidth="100"
                                            Content="{TemplateBinding DialogTitle}" />-->
                            <Button Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="2"
                                    HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,2,0"
                                    BorderThickness="1,1,1,1"                                                                      
                                    Command="Close">
                                <Button.Template>
                                    <ControlTemplate TargetType="{x:Type Button}">
                                        <Path x:Name="path" Stroke="#535666" Data="{StaticResource close}" Stretch="Uniform"
                                            Fill="White" Margin="0,0,0,0" Height="16" Width="44" StrokeThickness="1.2" />
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="path" Property="Fill"
                                                        Value="{StaticResource TitlebarCloseBackgroundBrush}"
                                                        />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Button.Template>
                                <!--<Button.LayoutTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="0.8" />
                                    </TransformGroup>
                                </Button.LayoutTransform>-->
                                <Button.RenderTransform>
                                    <TranslateTransform X="20" Y="5" />
                                </Button.RenderTransform>
                            </Button>

                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="DialogButtons" Value="OK">
                            <Setter TargetName="bOK" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="DialogButtons" Value="OKCancel">
                            <Setter TargetName="bOK" Property="Visibility" Value="Visible" />
                            <Setter TargetName="bCancel" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="DialogButtons" Value="YesNo">
                            <Setter TargetName="bYes" Property="Visibility" Value="Visible" />
                            <Setter TargetName="bNo" Property="Visibility" Value="Visible" />                            
                        </Trigger>
                        <Trigger Property="DialogButtons" Value="YesNoCancel">
                            <Setter TargetName="bYes" Property="Visibility" Value="Visible" />
                            <Setter TargetName="bNo" Property="Visibility" Value="Visible" />
                            <Setter TargetName="bCancel" Property="Visibility" Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
